﻿#region 命名空间

using System;
using System.Collections.Generic;
using Sharp.Domain.Model;
using Sharp.Infrastructure.Data;

#endregion

namespace Sharp.Domain.Repositories
{
    /// <summary>
    ///     表示实现该接口的类型是仓储上下文。
    /// </summary>
    public interface IRepositoryContext : IUnitOfWork, IDisposable
    {
        /// <summary>
        ///     获取仓储上下文的ID。
        /// </summary>
        Guid Id { get; }
        /// <summary>
        /// 注册新的聚合根
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TAggregateRoot"></typeparam>
        /// <param name="obj"></param>
        void RegisterNew<TKey, TAggregateRoot>(TAggregateRoot obj)
            where TAggregateRoot : class, IAggregateRoot<TKey> where TKey : struct;
        /// <summary>
        /// 注册新的聚合根
        /// </summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TAggregateRoot"></typeparam>
        /// <param name="aggregateRoots"></param>
        void RegisterNew<TKey, TAggregateRoot>(IEnumerable<TAggregateRoot> aggregateRoots)
              where TAggregateRoot : class, IAggregateRoot<TKey> where TKey : struct;

        /// <summary>
        ///     将指定的聚合根标注为“更改”状态。
        /// </summary>
        /// <typeparam name="TAggregateRoot">需要标注状态的聚合根类型。</typeparam>
        /// <typeparam name="TKey"></typeparam>
        /// <param name="obj">需要标注状态的聚合根。</param>
        void RegisterModified<TKey, TAggregateRoot>(TAggregateRoot obj)
            where TAggregateRoot : class, IAggregateRoot<TKey> where TKey : struct;

        /// <summary>
        ///     将指定的聚合根标注为“删除”状态。
        /// </summary>
        /// <typeparam name="TAggregateRoot">需要标注状态的聚合根类型。</typeparam>
        /// <typeparam name="TKey"></typeparam>
        /// <param name="obj">需要标注状态的聚合根。</param>
        void RegisterDeleted<TKey, TAggregateRoot>(TAggregateRoot obj)
            where TAggregateRoot : class, IAggregateRoot<TKey> where TKey : struct;

    }
}